﻿using Vroom.Config;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Configuration;
using System.Collections.Generic;
using Vroom.Common.Config;
using Moq;
using Vroom.Common;

namespace Vroom.Config.Test
{

    [TestClass()]
    public class ConfigFetcherTest
    {

        [TestMethod()]
        public void SetConnectionDetailsTest()
        {
            ConfigFetcher target = new ConfigFetcher();
            Dictionary<string, string> actual = target.ConnectionsDetails;

            Dictionary<string, string> expected = new Dictionary<string, string>()
            {
                {Consts.CONN_STR_CONF, @"Data Source=(localdb)\Projects;Initial Catalog=Config;Integrated Security=True;"},
                {Consts.CONN_STR_STG,  @"Data Source=(localdb)\Projects;Initial Catalog=Staging;Integrated Security=True;"}
            };

            CollectionAssert.AreEqual(expected, actual);
        }


        [TestMethod()]
        public void GetFileSourceLocationTest()
        {
            ConfigFetcher target = new ConfigFetcher();
            string expected = @"\\APLACEinternal\public\AppData\Datawarehouse\DEV\FileSource\Calypso";
            string actual = target.GetFileSourceLocation() + "Calypso";
            Assert.AreEqual(expected, actual, true, "Strings are different");
        }


        [TestMethod()]
        public void GetItemsToLoadTest()
        {
            ConfigFetcher target = new ConfigFetcher();
            List<IConfigItem> actual;
            actual = target.GetItemsToLoad();
            Assert.IsNotNull(actual);
        }

    }
}
